import {S3} from "@aws-sdk/client-s3";

/**
 * 定义全局唯一oss客户端
 */
const s3Client = new S3({
  endpoint: process.env.OSS_EXTERNAL_ENDPOINT,
  region: process.env.OSS_REGION,
  credentials: {
    accessKeyId: process.env.OSS_ACCESS_KEY,
    secretAccessKey: process.env.OSS_ACCESS_SECRET
  },
  forcePathStyle: true,
})


export async function download(bucket:string,filePath:string) {
    return  s3Client.getObject({
      Bucket: bucket,
      Key: filePath,
  })
}
